package com.frank.jpaSpecification.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * @author 小石潭记
 * @date 2020/10/4 14:14
 * @Description: ${todo}
 */
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_mobile")
public class Mobile {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    private String name;

    private String branch;

    private String address;

    private Double price;

    // 以下两个字段用于测试@CreateDate
    @CreatedDate
    @Column(name = "create_datetime", insertable = true, updatable = false, nullable = true)
    private LocalDateTime createDatetime;

    @LastModifiedDate
    private LocalDateTime modifyDatetime;
    /**
     * 创建人
     */
    @CreatedBy
    private Integer createBy;

    /**
     * 最后修改人
     */
    @LastModifiedBy
    private Integer lastModifiedBy;

}
